﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EzDesk.Project.Model;
using EzDesk.Project.Service.Repositories.Interfaces;

namespace EzDesk.Project.Service.Repositories.Mock
{
    public class Mock_ProjectTeamRepository : Mock_Repository<ProjectTeam>, IProjectTeamRepository
    {
        public Guid TestProjectId1 = new Guid("80CB7E0F-1B4E-428C-92D9-DED7D943AFE8");
        public Guid TestProjectTeamId1 = new Guid("E27306CB-FC1E-42D9-9020-5B453B7D3752");

        public Guid TestProjectId2 = new Guid("8B544374-105E-454D-900A-E389A9DA37EB");
        public Guid TestProjectTeamId2 = new Guid("E74D2241-0917-45D7-8C95-602502DFA834");

        public Mock_ProjectTeamRepository()
        {
            if (!HasInitialized)
            {
                innerManager.ClearAll();

                innerManager.Add(new ProjectTeam()
                {
                    Id = TestProjectTeamId1,
                    Manager = innerManager.ApiClient.GetSimpleUserById(innerManager.SampleUsers["杨裕欣"]),
                    Members = innerManager.ApiClient.GetSimpleUserInfos("everyone"),
                    ProjectId = TestProjectId1,
                }, true);

                innerManager.Add(new ProjectTeam()
                {
                    Id = TestProjectTeamId2,
                    Manager = innerManager.ApiClient.GetSimpleUserById(innerManager.SampleUsers["龚伟"]),
                    Members = innerManager.ApiClient.GetSimpleUserInfos("everyone"),
                    ProjectId = TestProjectId2,
                }, true);
            }
            base.Initialize();
        }

        public EzAppApi.Utility.EzDeskAppApi.SimpleUser GetProjectManager(Guid teamId)
        {
            return innerManager.GetAll().Where(p => p.Id == teamId).SingleOrDefault().Manager;
        }
    }
}

